import 'package:json_annotation/json_annotation.dart';

part 'user_info.g.dart';

@JsonSerializable()
class AccountInfo {
  final int userId;
  final String mobile;
  final String areaCode;
  final int registerTime;

  ///客户端类型：1=device、2=ios、android,
  final int clientType;

  ///统一账号中心id,
  final int gowildId;

  ///coin
  final int coinCount;
  final String versionModule;
  final int versionCode;
  final String accessToken;
  final int loginTime;

  ///用户注册阶段：1.未注册。2.注册未填。3.注册已填
  final int userStage;

  ///用户vip级别,
  final int userVip;

  ///用户vip过期时间
  final int vipExpiryTime;
  final bool vipExpired;
  final int delayTime;
  final int deviceId;
  ///DAYEXIU C2 YEXIU
  final String idol;
  final List<IdolInfo> idolList;
  final UserInfoModel userInfo;
  final UserFaceInfo userAgent;
  final int gloryCoinCount;

  AccountInfo(
      this.userId,
      this.mobile,
      this.clientType,
      this.gowildId,
      this.coinCount,
      this.accessToken,
      this.loginTime,
      this.userStage,
      this.userVip,
      this.vipExpiryTime,
      this.vipExpired,
      this.delayTime,
      this.versionModule,
      this.versionCode,
      this.areaCode,
      this.registerTime,
      this.userInfo,
      this.userAgent,
      this.deviceId,
      this.idol,
      this.idolList,
      this.gloryCoinCount);

  factory AccountInfo.fromJson(Map<String, dynamic> json) =>
      _$AccountInfoFromJson(json);

  Map<String, dynamic> toJson() => _$AccountInfoToJson(this);
}

@JsonSerializable()
class IdolInfo {
  final String idol;
  final String showUrl;
  final int canSwitch;
  final String desc;

  IdolInfo(this.idol, this.showUrl, this.canSwitch, this.desc);

  factory IdolInfo.fromJson(Map<String, dynamic> json) =>
      _$IdolInfoFromJson(json);

  Map<String, dynamic> toJson() => _$IdolInfoToJson(this);
}

@JsonSerializable()
class UserInfoModel {
  final int birthday;
  final String videoTag;
  final String musicTag;
  final String homeTag;
  final String address;
  final String mobile;
  final String nickname;
  final String avatarUrl;
  final int gloryCoinCount;
  ///0: 未知, 1: 男性, 2: 女性
  final int sex;

  UserInfoModel(this.birthday, this.videoTag, this.musicTag, this.homeTag,
      this.address, this.mobile, this.nickname, this.avatarUrl, this.sex, this.gloryCoinCount);

  factory UserInfoModel.fromJson(Map<String, dynamic> json) =>
      _$UserInfoModelFromJson(json);

  Map<String, dynamic> toJson() => _$UserInfoModelToJson(this);
}

@JsonSerializable()
class UserFaceInfo {
  final int id;
  final int userId;
  final int faceId;
  final String uploadUrl;
  final int supplier;
  final String nickname;
  final int age;
  final int sex;
  final int birthday;
  final int faceScore;
  final int expression;
  final String relationship;
  final int status;
  final int createTime;

  UserFaceInfo(
      this.userId,
      this.faceId,
      this.uploadUrl,
      this.supplier,
      this.nickname,
      this.age,
      this.sex,
      this.birthday,
      this.faceScore,
      this.expression,
      this.relationship,
      this.status,
      this.createTime,
      this.id);

  factory UserFaceInfo.fromJson(Map<String, dynamic> json) =>
      _$UserFaceInfoFromJson(json);

  Map<String, dynamic> toJson() => _$UserFaceInfoToJson(this);
}

class UserInfoModelReq {
  int birthday;
  String videoTag;
  String musicTag;
  String homeTag;
  String address;
  String mobile;
  String nickname;
  String avatarUrl;
  ///0: 未知, 1: 男性, 2: 女性
  int sex;

  UserInfoModelReq({this.birthday, this.videoTag, this.musicTag, this.homeTag,
    this.address, this.mobile, this.nickname, this.avatarUrl, this.sex});

  Map<String, dynamic> toJson() => _$UserInfoModelReqToJson(this);

  Map<String, dynamic> _$UserInfoModelReqToJson(UserInfoModelReq instance) =>
      <String, dynamic>{
        'birthday': instance.birthday,
        'videoTag': instance.videoTag,
        'musicTag': instance.musicTag,
        'homeTag': instance.homeTag,
        'address': instance.address,
        'mobile': instance.mobile,
        'nickname': instance.nickname,
        'avatarUrl': instance.avatarUrl,
        'sex': instance.sex
      };
}
